export HASTHI_HOME=`pwd`
cd $HASTHI_HOME

#RESOURCE_PER_MANAGER="200 300 400 500 600 700 800 900 1000"

RESOURCE_PER_MANAGER="50 10"
MNG_COUNT_PER_HOST="10"
HOST_COUNT="10"
MNG_COUNT=$(($MNG_COUNT_PER_HOST*$HOST_COUNT))

for md in ${RESOURCE_PER_MANAGER}; do
		$HASTHI_HOME/bootstrap.sh reset
		sleep 1s

		RESOURCE_COUNT=$(($MNG_COUNT*$md))
		export LOG_DIR=/u/hperera/logs/hasthi_${RESOURCE_COUNT}X${MNG_COUNT}_`date +%m_%d_%H_%M`
		echo $LOG_DIR
		mkdir $LOG_DIR
		cmd1="srun -N 1 ./testMngeNode.sh $HASTHI_HOME/hasthi.properties $HASTHI_HOME $LOG_DIR"
		cmd2="srun -N $HOST_COUNT ./simMng.sh $MNG_COUNT_PER_HOST $md"
		echo $cmd1 $cmd2
		$cmd1 &
		sleep 40s
		$cmd2
		#Following wait for all child processes to complete 
		wait
		mv hasthi*.log $LOG_DIR
		echo $MNG_COUNT"X"$RESOURCE_COUNT "Done"
done 
